/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package co.gov.igac.observatorio.entidades.idea;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author jgamba
 */
@Entity
@Table(name = "lineainvestigacion")
@NamedQueries({
    @NamedQuery(name = "Lineainvestigacion.findAll", query = "SELECT l FROM Lineainvestigacion l"),
    @NamedQuery(name = "Lineainvestigacion.findByIdLineaInvestigacion", query = "SELECT l FROM Lineainvestigacion l WHERE l.idLineaInvestigacion = :idLineaInvestigacion"),
    @NamedQuery(name = "Lineainvestigacion.findByNombreLinea", query = "SELECT l FROM Lineainvestigacion l WHERE l.nombreLinea = :nombreLinea"),
    @NamedQuery(name = "Lineainvestigacion.findByDescripcion", query = "SELECT l FROM Lineainvestigacion l WHERE l.descripcion = :descripcion")})
public class Lineainvestigacion implements Serializable {
    @OneToMany(mappedBy = "lineainvestigacion")
    private List<Idea> ideaList;
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "idLineaInvestigacion")
    private Integer idLineaInvestigacion;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "nombreLinea")
    private String nombreLinea;
    @Size(max = 200)
    @Column(name = "descripcion")
    private String descripcion;
    @JoinColumn(name = "Subdireccion_idSubdireccion", referencedColumnName = "idSubdireccion")
    @ManyToOne(optional = false)
    private Subdireccion subdireccion;

    public Lineainvestigacion() {
    }

    public Lineainvestigacion(Integer idLineaInvestigacion) {
        this.idLineaInvestigacion = idLineaInvestigacion;
    }

    public Lineainvestigacion(Integer idLineaInvestigacion, String nombreLinea) {
        this.idLineaInvestigacion = idLineaInvestigacion;
        this.nombreLinea = nombreLinea;
    }

    public Integer getIdLineaInvestigacion() {
        return idLineaInvestigacion;
    }

    public void setIdLineaInvestigacion(Integer idLineaInvestigacion) {
        this.idLineaInvestigacion = idLineaInvestigacion;
    }

    public String getNombreLinea() {
        return nombreLinea;
    }

    public void setNombreLinea(String nombreLinea) {
        this.nombreLinea = nombreLinea;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public Subdireccion getSubdireccion() {
        return subdireccion;
    }

    public void setSubdireccion(Subdireccion subdireccion) {
        this.subdireccion = subdireccion;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idLineaInvestigacion != null ? idLineaInvestigacion.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Lineainvestigacion)) {
            return false;
        }
        Lineainvestigacion other = (Lineainvestigacion) object;
        if ((this.idLineaInvestigacion == null && other.idLineaInvestigacion != null) || (this.idLineaInvestigacion != null && !this.idLineaInvestigacion.equals(other.idLineaInvestigacion))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "co.gov.igac.observatorio.entidades.idea.Lineainvestigacion[ idLineaInvestigacion=" + idLineaInvestigacion + " ]";
    }

    public List<Idea> getIdeaList() {
        return ideaList;
    }

    public void setIdeaList(List<Idea> ideaList) {
        this.ideaList = ideaList;
    }
    
}
